package refactoring;

public class IndexedContainner<T> implements Comparable<IndexedContainner<T>> {

	private int index;
	private T content;

	public IndexedContainner(int index, T content) {
		this.index = index;
		this.content = content;
	}

	public int getIndex() {
		return index;
	}

	public T getContent() {
		return content;
	}

	protected void setContent(T element) {
		this.content = element;
	}

	protected void setIndex(int index) {
		this.index = index;
	}

	@Override
	public int compareTo(IndexedContainner<T> o) {

		if (getIndex() > o.getIndex()) {
			return 1;
		}

		if (getIndex() < o.getIndex()) {
			return -1;
		}

		return 0;
	}

}
